<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp" %>
<script type="text/javascript">
    $(function () {
        $("#manage_register_datagrid").treegrid({});
        //$.acooly.framework.registerKeydown('manage_org_searchform', 'manage_org_datagrid');

    });
</script>
<div class="easyui-layout" data-options="fit : true,border : false">

    <!-- 列表和工具栏 -->
    <div data-options="region:'center',border:false">
        <table id="manage_register_datagrid" class="easyui-treegrid"
               url="${pageContext.request.contextPath}/manage/demo/register/queryList.html" toolbar="#manage_register_toolbar"fit="true" border="false" fitColumns="false"
               pagination="true" idField="id" pageSize="20" pageList="[ 10, 20, 30, 40, 50 ]" sortName="id" sortOrder="desc" checkOnSelect="true" selectOnCheck="true" singleSelect="true">
            <thead>
            <tr>
                <th field="showCheckboxWithId" checkbox="true" data-options="formatter:function(value, row, index){ return row.id }">编号</th>
                <th field="ename" >进入机房人员</th>
                <th field="explain">情况说明</th>
                <th field="remarks">备注</th>
                <th field="creattime">进入时间</th>
                <th field="rowActions"  data-options="formatter:function(value, row, index){return formatAction('manage_register_action1',value,row)}">操作</th>
            </tr>
            </thead>
        </table>
        <div id="manage_register_action1" style="display: none;">
            <a onclick="query('{0}')" href="#" title="删除"><i class="fa fa-trash-o fa-lg fa-fw fa-col"></i></a>
        </div>
        <!-- 表格的工具栏 -->
        <div id="manage_register_toolbar">
            <a href="#" class="easyui-linkbutton" plain="true"
               onclick="manage_register_equipment()"><i
                    class="fa fa-plus-circle fa-lg fa-fw fa-col"></i>添加</a>
        </div>
    </div>
</div>


<script>
function query(id) {
    $.post("/manage/demo/register/delete.html",{"id":id},function () {
        $("#manage_register_datagrid").treegrid({});
    })
    debugger

}
    function manage_register_equipment(){
        debugger
        var saveBtn = {
            id: 'acooly-framework-add-btn',
            text: '添加',
            handler: function () {
                var manage_register_editform=serializeObject($('#manage_register_editform'));
                $.post("/manage/demo/register/save.html",manage_register_editform,function (r) {
                    $('#manage_register_datagrid').datagrid('load');
                    $.parser.parse();
                    d.dialog('close');
                })
            }
        };
        var closeBtn = {
            text: '<i class="fa fa-times-circle fa-lg fa-fw fa-col" ></i>关闭',
            handler: function () {
                d.dialog('close');
            }
        };
        var buttons = buttons || [];
        buttons.push(saveBtn);
        buttons.push(closeBtn);
        var d = $('<div/>').dialog({
            href: "/manage/demo/register/registerEdit.html",
            title: '添加',
            width: 600,
            height: 500,
            modal: true,
            /*iconCls : 'icon-save',*/
            buttons:buttons,
            onClose: function () {
                $(this).dialog('destroy');
            }
        });
    }

</script>